{% extends "admin/base_site.html" %}


{% block breadcrumbs %}
    <ul class="breadcrumb">
        <li>
            <a href="{% url 'admin:index' %}">Home</a>
            <span class="divider">»</span>
        </li>
        <li>
            <a href="{% url 'rq_home' %}">Django RQ</a>
            <span class="divider">»</span>
        </li>
        <li>
            <a href="{% url 'rq_jobs' queue_index %}">{{ queue.name }}</a>
            <span class="divider">»</span>
        </li>
        <li class="active">
            <a href="{% url 'rq_job_detail' queue_index job.id %}">{{ job.id }}</a>
        </li>
    </ul>
{% endblock %}

{% block content_title %}<h1>Job Info</h1>{% endblock %}

{% block content %}

<div id="content-main">

    <div class="module">

        <table class="table table-striped table-bordered table-hover table-condensed">
            <tbody>
                <tr>
                    <th>ID:</th>
                    <td>{{ job.id }}</td>
                </tr>
                <tr>
                    <th>Queue:</th>
                    <td>{{ job.origin }}</td>
                </tr>
                <tr>
                    <th>Timeout:</th>
                    <td>{{ job.timeout }}</td>
                </tr>
                <tr>
                    <th>Result TTL:</th>
                    <td>{{ job.result_ttl }}</td>
                </tr>
                <tr>
                    <th>Created:</th>
                    <td>{{ job.created_at }}</td>
                </tr>
                <tr>
                    <th>Queued:</th>
                    <td>{{ job.enqueued_at }}</td>
                </tr>
                <tr>
                    <th>Status:</th>
                    <td>{{ job.get_status }}</td>
                </tr>
                <tr>
                    <th>Callable:</th>
                    <td>{{ job.func_name }}</td>
                </tr>
                {% if job.args %}
                <tr>
                    <th>Args:</th>
                    <td>
                        <ul>
                            {% for arg in job.args %}
                                <li>{{ arg }}</li>
                            {% endfor %}
                        </ul>
                    </td>
                </tr>
                {% endif %}
                {% if job.kwargs %}
                <tr>
                    <th>Kwargs:</th>
                    <td>
                        <ul>
                            {% for key, value in job.kwargs.items %}
                                <li>{{ key }}: {{ value|escape }}</li>
                            {% endfor %}
                        </ul>
                    </td>
                </tr>
                {% endif %}
                {% if job.exc_info %}
                <tr>
                    <th>Exception:</th>
                    <td><pre>{{ job.exc_info|linebreaks }}</pre></td>
                </tr>
                {% endif %}
            </tbody>
        </table>
    </div>

    <div class="submit-row">
        <form method="POST" action="{% url 'rq_requeue_job' queue_index job.id %}">
            {% if job.is_failed %}
                {% csrf_token %}
                <input type="submit" value="Requeue" class="btn btn-success" name="requeue">
            {% endif %}
            <a href="delete/" class="btn btn-danger">Delete</a>
        </form>
    </div>

</div>

{% endblock %}
